#ifndef PFM_H
#define PFM_H

#include <vector>
#include <iostream>

typedef struct
{
   float r,g,b;
} HDRPIXEL;

template <typename T>
struct vector2d
{
    vector2d() : columns(0) {}

    int columns;
    std::vector <T> data;

    int getColumns() const {return columns;}
    int getRows() const {return data.size() / columns;}
    const T & get(int x, int y) const
    {
        return data[x+y*columns];
    }
};

// returns empty vector data on failure
// logs output to provided ostream if non-null
const vector2d <HDRPIXEL> loadPfm(const char * file, std::ostream * output);

#endif
